<%
String query = request.getParameter("q");

if(query == null || query.equals("")) {
    query = "";
}

String order = request.getParameter("o");
String isDefaultChecked = "";
String isTimeDampChecked = "";
String isSortByDateChecked = "";

if(order != null) {
    if(order.equalsIgnoreCase("none")) {
        isDefaultChecked = "checked=\"checked\"";
    } else if(order.equalsIgnoreCase("timedamp")) {
        isTimeDampChecked = "checked=\"checked\"";
    } else if(order.equalsIgnoreCase("date")) {
        isSortByDateChecked = "checked=\"checked\"";
    }
} else {
    isDefaultChecked = "checked=\"checked\"";
}

String fromDate = request.getParameter("fdate");
String toDate = request.getParameter("tdate");

if(fromDate == null || toDate == null || fromDate.equals("") || toDate.equals("")) {
    fromDate = "";
    toDate = "";
}
%>


 <table>
                    <form action="search">
                        <tr>
                            <td>
                                <input type="text" maxlength="2048" name="q" id="q" size="35" value="<%= query %>"> &nbsp; <input type="submit" value=" Search " id="bSearch"><br>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <font size="2"><input type="radio" name="o" value="none" <%= isDefaultChecked %>> Default &nbsp; <input type="radio" name="o" value="timedamp" <%= isTimeDampChecked %>> Text + Time &nbsp; <input type="radio" name="o" value="date" <%= isSortByDateChecked %>> Time </font>
                            </td>
                        </tr>
                    </form>
                </table>  
                